package org.springboot.email;


import java.util.Properties;

import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;

import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.mail.javamail.MimeMessageHelper;

public class cc {

	public static void main(String[] args) {
		JavaMailSenderImpl sender = new JavaMailSenderImpl();
		sender.setHost("smtp.qq.com");
		sender.setPort(465);
		sender.setUsername("1131126268@qq.com");
		sender.setPassword("xlogzxatztfnbaea");
		
		Properties pro = System.getProperties();
		pro.put("mail.smtp.auth", "true");
		pro.put("mail.smtp.ssl.enable", "true");
		pro.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
		
		sender.setJavaMailProperties(pro);
		
		
		MimeMessage message = sender.createMimeMessage();
		try {
			MimeMessageHelper helper = new MimeMessageHelper(message, true); 
			helper.setFrom("1131126268@qq.com"); 
			helper.setTo("18260346196@163.com"); 
			helper.setSubject("cctitlecc"); 
			helper.setText("ccxxxxxxxxxxxxxxxxxxxcc"); 
			
			sender.send(message);
			System.out.println("done");
		} catch (MessagingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
